﻿using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using Sustainalytics.Synchronization.Interface;

namespace Sustainalytics.CRT.Synchronization.Tests.Integration
{
    public static class TestSyncContextFactoy
    {
        const string GaMongoIp = "54.72.160.155";
        const string DsoMongoIp = "52.208.112.211";
        const string Redis = "52.209.225.41";

        public static SyncContext Create(Action<string> log = null)
        {
            var context = new SyncContext(ErrorPolicy.BreakRightAway, log)
            {
                GAConnectionStrings = new Dictionary<string, string>(),
                DSOConnectionStrings = new Dictionary<string, string>(),
                LastGAConnectionStrings = new Dictionary<string, string>(),
                Report = new ConcurrentBag<string>(),
                CompanyUniverses = new Dictionary<Guid, List<int>>(),
                PreviousChanges = new List<ChangedElement>(),
                SelectedSteps = new List<SyncStepOrder>() { SyncStepOrder.FocusedRatingsComputationOutput2 }

            };
            context.GAConnectionStrings["ClientPlatform"] = $"mongodb://{GaMongoIp}:27017/ClientPlatform";
            context.GAConnectionStrings["ClientUniverses"] = $"mongodb://{GaMongoIp}:27017/ClientUniverses";
            context.GAConnectionStrings["RPHistoricalDataSet"] = $"mongodb://{GaMongoIp}:27017/RPHistoricalDataSet";
            context.GAConnectionStrings["ClientDW"] = $"mongodb://{GaMongoIp}:27017/ClientDW_B";
            context.LastGAConnectionStrings["ClientDW"] = $"mongodb://{GaMongoIp}:27017/ClientDW_A";
            context.GAConnectionStrings["GovernanceDW"] = $"mongodb://{GaMongoIp}:27017/GovernanceDW_A";
            context.LastGAConnectionStrings["GovernanceDW"] = $"mongodb://{GaMongoIp}:27017/GovernanceDW_B";
            context.GAConnectionStrings["RedisConnectionString"] = Redis;

            context.DSOConnectionStrings["ScreeningDW"] = $"mongodb://{DsoMongoIp}:27017/ScreeningDW_A";
            context.GAConnectionStrings["DWArchive"] = $"mongodb://{GaMongoIp}:27017/DWArchive_A";
            context.GAConnectionStrings["ControversyReportPDF"] = $"mongodb://{GaMongoIp}:27017/ControversyReportPDF_A";
            context.GAConnectionStrings["CompanyReportPDF"] = $"mongodb://{GaMongoIp}:27017/CompanyReportPDF_A";

            return context;
        }
    }
}
